package com.springboot.demo.service;

import com.springboot.demo.entity.*;
import com.springboot.demo.entity.data.MsgData;

import java.util.Date;
import java.util.List;

/**
 * @author wubc683
 * @desc
 * @date 2021-09-13 9:18
 */
public interface SceneService {
    /**
     * 获取组态信息
     *
     * @param uid
     * @param sid
     * @return: Scene
     */
    Scene getSceneInfo(Long uid, Long sid);

    /**
     * 创建组态信息
     *
     * @param uid
     * @param scene
     * @return: void
     */
    void saveSceneInfo(Long uid, Scene scene);

    /**
     * 分享组态
     *
     * @param ownerId
     * @param sid
     * @param username
     * @return: void
     */
    void shareSceneInfo(Long ownerId, Long sid, String username);

    /**
     * 分享组态回复
     *
     * @param uid
     * @param data
     * @return: void
     */
    void replyShareSceneInfo(Long uid, MsgData data);

    /**
     * 修改组态信息
     *
     * @param id
     * @param scene
     * @return: void
     */
    void updateSceneInfo(Long id, Scene scene);

    /**
     * 删除一些组态
     *
     * @param uid
     * @param sceneIds
     * @return: void
     */
    void delSceneInfo(Long uid, List<Long> sceneIds);

    /**
     * 获取组态连接数据
     *
     * @param request
     * @param uid
     * @param sid
     * @return: com.springboot.demo.entity.PageResult
     */
    PageResult getSceneConnData(PageRequest request, Long uid, Long sid);

    /**
     * 获取组态变量数据
     *
     * @param request
     * @param id
     * @param sid
     * @param mode
     * @return: com.springboot.demo.entity.PageResult
     */
    PageResult getSceneVarData(PageRequest request, Long id, Long sid, Integer mode);

    /**
     * 获取组态模拟量数据
     *
     * @param request
     * @param id
     * @param sid
     * @return: com.springboot.demo.entity.PageResult
     */
    PageResult getSceneAnalogAlarm(PageRequest request, Long id, Long sid);

    /**
     * 获取组态离散量数据
     *
     * @param pageRequest
     * @param uid
     * @param sid
     * @return: com.springboot.demo.entity.PageResult
     */
    PageResult getSceneDiscreteAlarm(PageRequest pageRequest, Long uid, Long sid);

    /**
     * 发布组态数据
     *
     * @param uid
     * @param sceneId
     * @return: void
     */
    void publishSceneData(Long uid, Long sceneId);

    /**
     * 创建组态文件夹
     *
     * @param id
     * @param pid
     * @param name
     * @return: void
     */
    void saveSceneGroup(Long id, Long pid, String name);

    /**
     * 修改组态文件夹
     *
     * @param id
     * @param pid
     * @param gid
     * @param name
     * @return: void
     */
    void updateSceneGroup(Long id, Long pid, Long gid, String name);

    /**
     * 删除组态文件夹
     *
     * @param uid
     * @param gid
     * @return: void
     */
    void delSceneGroup(Long uid, Long gid);


    /**
     * 获取不同分组组态信息
     *
     * @param pageRequest
     * @param uid
     * @param gid
     * @param sort
     * @param startDate
     * @param endDate
     * @param search
     * @return: com.springboot.demo.entity.PageResult
     */
    PageResult getDiffGroupSceneInfo(PageRequest pageRequest, Long uid, Long gid, String sort,
                                     Date startDate, Date endDate, String search);

    /**
     * 获取一条连接数据
     *
     * @param uid
     * @param connectId
     * @return: com.springboot.demo.entity.Connection
     */
    Connection getOneSceneConnData(Long uid, Long connectId);

    /**
     * 创建连接
     *
     * @param uid
     * @param connection
     * @return: void
     */
    void saveSceneConnData(Long uid, Connection connection);

    /**
     * 修改连接
     *
     * @param uid
     * @param connection
     * @return: void
     */
    void updateSceneConnData(Long uid, Connection connection);

    /**
     * 删除连接
     *
     * @param id
     * @param connIds
     * @return: void
     */
    void delSceneConnData(Long id, List<Long> connIds);

    /**
     * 创建变量
     *
     * @param uid
     * @param var
     * @return: void
     */
    void saveSceneVarData(Long uid, Variable var);

    /**
     * 获取一条变量
     *
     * @param id
     * @param varId
     * @return: org.aspectj.weaver.ast.Var
     */
    Variable getOneSceneVarData(Long id, Long varId);

    /**
     * 修改变量
     *
     * @param id
     * @param var
     * @return: void
     */
    void updateSceneVarData(Long id, Variable var);

    /**
     * 删除变量
     *
     * @param uid
     * @param varIds
     * @return: void
     */
    void delSceneVarData(Long uid, List<Long> varIds);

    /**
     * 获取一条模拟量
     *
     * @param uid
     * @param analogId
     * @return: com.springboot.demo.entity.AnalogAlarm
     */
    AnalogAlarm getOneSceneAnalogData(Long uid, Long analogId);

    /**
     * 创建模拟量
     *
     * @param uid
     * @param analog
     * @return: void
     */
    void saveSceneAnalogData(Long uid, AnalogAlarm analog);

    /**
     * 修改模拟量
     *
     * @param id
     * @param analog
     * @return: void
     */
    void updateSceneAnalogData(Long id, AnalogAlarm analog);

    /**
     * 删除模拟量
     *
     * @param uid
     * @param analogIds
     * @return: void
     */
    void delSceneAnalogData(Long uid, List<Long> analogIds);

    /**
     * 获取一条离散量
     *
     * @param uid
     * @param discreteId
     * @return: com.springboot.demo.entity.DiscreteAlarm
     */
    DiscreteAlarm getOneSceneDiscreteData(Long uid, Long discreteId);

    /**
     * 创建离散量
     *
     * @param uid
     * @param discrete
     * @return: void
     */
    void saveSceneDiscreteData(Long uid, DiscreteAlarm discrete);

    /**
     * 修改离散量
     *
     * @param id
     * @param discrete
     * @return: void
     */
    void updateSceneDiscreteData(Long id, DiscreteAlarm discrete);

    /**
     * 删除离散量
     *
     * @param uid
     * @param discreteIds
     * @return: void
     */
    void delSceneDiscreteData(Long uid, List<Long> discreteIds);

    /**
     * 获取组态连接的所有驱动类型
     *
     * @param
     * @return: java.util.List<java.lang.String>
     */
    List<DriveType> getAllDriveType();

    /**
     * 获取组态变量属性
     *
     * @param num
     * @return: java.util.List<com.springboot.demo.entity.VarAttribute>
     */
    List<VarAttribute> getVarAddrByDriveTypeAndDataType(Integer num);

    /**
     * 获取所有组态文件夹
     *
     * @param uid
     * @param pageRequest
     * @return: com.springboot.demo.entity.PageResult
     */
    PageResult getSceneGroups(Long uid, PageRequest pageRequest);

    /**
     * 运行or停止组态
     *
     * @param uid
     * @param sceneId
     * @param command
     * @return: void
     */
    void runScene(Long uid, Long sceneId, Boolean command);

//    /**
//     * 给组态配置设备
//     *
//     * @param uid
//     * @param sceneDevices
//     * @return: void
//     */
//    void saveSceneDevice(Long uid, List<SceneDevice> sceneDevices);

    /**
     * 获取组态连接配置设备
     * @param uid
     * @param sceneId
     * @return: java.util.List<com.springboot.demo.entity.ConnectDevice>
     */
    List<ConnectDevice> getSceneDevice(Long uid, Long sceneId);

    /**
     * 修改组态连接配置设备
     *
     * @param uid
     * @param connDevice
     * @return: void
     */
    void updateConnDevice(Long uid, ConnDevice connDevice);

    /**
     * 删除连接对应设备
     *
     * @param uid
     * @param connIds
     * @return: void
     */
    void delSceneDevice(Long uid, List<Long> connIds);

    /**
     * 获取组态设备
     * @param userId
     * @param sid
     * @return: java.util.List<com.springboot.demo.entity.Device>
     */
    List<Device> getSceneDevices(Long userId, Long sid);

    /**
     * 获取组态变量信息
     * @param userId
     * @param sid
     * @param varNo
     * @return: com.springboot.demo.entity.Variable
     */
    Variable getSceneVarInfo(Long userId, Long sid, Integer varNo);

    /**
     * 复制组态信息
     * @param ownerId
     * @param sceneId
     * @return: void
     */
    void copySceneInfo(Long ownerId, Long sceneId);

    /**
     * 获取可用于配置组态连接的设备
     * @param userId
     * @param sceneId
     * @return: java.util.List<com.springboot.demo.entity.ConnectDevice>
     */
    List<ConnectDevice> getSceneConfigDevice(Long userId, Long sceneId);
}
